package com.example.redisdemo.demos;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: RedisDemo
 * @Description:
 * @Date 2024/04/03 15:05
 * @Author songshaoqiu
 **/
@RestController
public class RedisDemo {
        @Autowired
        StringRedisTemplate redisTemplate;
   @GetMapping("/redis")
    public String redisT(@RequestParam("type")Integer type){
       redisTemplate.opsForValue().set("key"+type,type.toString());

       Object o = redisTemplate.opsForValue().get("key" + type);
       return (String) o;

   }

    public static void main(String[] args) {
        String order = "cddd123-aavvcc";
        String[] split = order.split("-");
        String order1 = split[0];
        System.out.println(order);
        System.out.println(order1);
    }


}
